package io.renren.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.renren.common.utils.PageUtils;
import io.renren.dao.JxStudentScheduleDao;
import io.renren.entity.JxStudentScheduleEntity;
import io.renren.service.JxStudentScheduleService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("jxStudentScheduleService")
public class JxStudentScheduleServiceImpl extends ServiceImpl<JxStudentScheduleDao, JxStudentScheduleEntity> implements JxStudentScheduleService {

    @Override
    public PageUtils getAllWithPage(Map<String, Object> params) {
        PageHelper.startPage(Integer.parseInt(params.get("page").toString()),Integer.parseInt(params.get("limit").toString()));
        List<JxStudentScheduleEntity> list = this.baseMapper.getList(params);
        for(JxStudentScheduleEntity entity:list){
          entity.setUseDeviceId(null);
        }
        PageInfo<JxStudentScheduleEntity> pageInfo = new PageInfo<JxStudentScheduleEntity>(list);
        return new PageUtils(list,(int)pageInfo.getTotal(),pageInfo.getPageSize(),pageInfo.getPageNum());
    }

    @Override
    public List<JxStudentScheduleEntity> getList(Map<String, Object> params) {
        return this.baseMapper.getList(params);
    }
}
